package com.springboot.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.springboot.dal.mapper.UsermessageMapper;

@Service
public class UserService {
	@Autowired
	private JdbcTemplate jt;
	
	@Autowired
	private UsermessageMapper um;

	public List<Map<String,Object>> select(){
		return jt.queryForList("select * from usermessage");
	}
	
	@Transactional
	public int update(){
		//String sql = "update usermessage set username ='updated' where id=0 ";
		//jt.update(sql);
		
		um.deleteByPrimaryKey(2);
		//int h = 1/0;
		return 0;
		
	}
}
